import http from "../index";
import { PORT1 } from "@/api/config/servicePort";
import qs from "qs";
import { ResPage, Activity } from "../interface/index";
import { Detail, createActivity, OtherInfo } from "../interface/detail";
// import { ActivityFormList } from "@/types/createActivity";

// 弹窗广告
export const createPopupActivityAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoCreate", params);
};
export const getPopupAvtivityDetailAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/GetEdit", params);
};

export const editPopupActivityAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoEdit", params);
};

// 菜品推荐
export const createRecommendActivityAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoCreate", params);
};
export const getRecommendActivityDetailAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/GetEdit", params);
};
export const editRecommendActivityAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoEdit", params);
};

export const grantMessageAPI = (params?: {}) => {
  return http.post(PORT1 + "/corecmssmstemplate/getpagelist", params);
};

export const createMessageAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssmstask/docreate", params);
};

export const getMessageListAPI = (params: {}) => {
  return http.post<ResPage<Activity.ActivityMemberList>>(PORT1 + "/corecmssmstask/GetPageList", qs.stringify(params));
};

export const deleteMessageAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssmstask/DoDelete", params);
};

// 创建菜品换购活动
export const createExchangeProductAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoCreate", params);
};

// 获取单条数据详细
export const getExchangeDetailAPI = (params: {}) => {
  return http.post<createActivity.ExchangeDetail>(PORT1 + "/corecmssalespromotion/GetEdit", params);
};
// 编辑单条数据详细
export const editExchangeDetailAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoEdit", params);
};

// 创建消费送礼活动
export const createConsumerAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoCreate", params);
};

export const getConsumerDetailAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/GetEdit", params);
};
export const editConsumerAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/DoEdit", params);
};

export const SendActivityNotice = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/SendActivityNotice", params);
};
export const getTraceInfoAPI = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/ActivityTracking", params);
};

export const getPartActivityList = (params: {}) => {
  return http.post<OtherInfo.GetPartActivityList>(PORT1 + "/corecmspromotionuser/GetPageList", qs.stringify(params));
};
// 停止或者开启活动
export const movableSwitch = (params: {}) => {
  return http.post(PORT1 + "/corecmssalespromotion/ChangeStatus", params);
};

// 删除活动
export const deleteCorecmssalespromotion = (params: {}) => {
  return http.post(PORT1 + `/corecmssalespromotion/DoDelete`, params);
};
